package com.exp.collection;

import java.util.ArrayList;
import java.util.Collections;


class Employ1 implements Comparable<Employ1> {
	Integer id;
	String Name;
	String Addr;
	String Gender;
	Double Sal;
	public Employ1(int a,String b,String c,Double d,String e) {
		this.id = a;
		this.Name = b;
		this.Addr =c;
		this.Sal = d;
		this.Gender = e;
	}
	
	public String toString() {
		Integer i = this.id;
		return i.toString();
		
	}
	public int getId(){
		return this.id;
	}
	
	public void setId(int id) {
		 this.id = id;
	}
	
	@Override
	public int compareTo(Employ1 o) {
		// TODO Auto-generated method stub
		return id.compareTo(o.getId());
	}
}


public class SortbyIdEmp {

	public static void main(String[] args) {
		ArrayList<Employ1> emp = new ArrayList<Employ1>();
		emp.add(new Employ1(60,"Jaya","Blore",20000.40,"f"));
		emp.add(new Employ1(220,"maya","Mlore",25000.40,"f"));
		emp.add(new Employ1(20,"liya","Hubli",200800.40,"m"));
		emp.add(new Employ1(4820,"geeya","Bangalore",29000.40,"m"));
		emp.add(new Employ1(10,"Jaa","Blr",39000.40,"f"));
		System.out.println("Unsorted Idr");
		System.out.println(emp);
		Collections.sort(emp);
		System.out.println("After Sort by Idr" + emp);
	}
}
